#include "cStateManager.h"
CStateManager* CStateManager::s_pIntance = 0;
void CStateManager::Update(bool isPaused)
{
	if(this->pCurrentState == this->pNextState)
	{
		if(this->pCurrentState)
		{
			this->pCurrentState->Exit();
			delete this->pCurrentState;
		}
		if(this->pNextState)
		{
			this->pCurrentState = this->pNextState;
			this->pCurrentState->Init();
		}
	}
	if(this->pCurrentState)
	{
		if(!isPaused)
		{
			this->pCurrentState->Update();
		}
		this->pCurrentState->Render();
	}
}
void CStateManager::SwitchState(CState *nextState)
{
	this->pNextState = nextState;
}